import request from "@/utils/request";
import { AttrList, getAttrListApiParams, AttrItem } from "./type/attrType";
const enum Api {
  getAttrList = "/admin/product/attrInfoList",
  addOrUpdateAttr = "/admin/product/saveAttrInfo",
  deleteAttr = "/admin/product/deleteAttr",
}
export const getAttrListApi = ({
  category1Id,
  category2Id,
  category3Id,
}: getAttrListApiParams) => {
  return request.get<never, AttrList>(
    Api.getAttrList + `/${category1Id}/${category2Id}/${category3Id}`
  );
};
// 添加或更新属性
export const addOrUpdateAttrApi = (data: AttrItem) => {
  return request.post<any, null>(Api.addOrUpdateAttr, data);
};
// 删除一条数据
export const deleteAttrApi = (attrId: number) => {
  return request.delete<any, null>(Api.deleteAttr + `/${attrId}`);
};
